<template>
  <div class="search">
    <f-form ref="form" :action="api.insurant" :form-key="this.formItem.insurantId" >
      <f-form-item label="姓名"  name="userName" dataType="${formField.dataType}"   :value="formItem.userName" />
      <f-form-item label="证件类型（1身份证，2护照 3港澳台,4军官证,5其他）"  name="identityType" dataType="number"   :value="formItem.identityType" />
      <f-form-item label="证件号"  name="identityNo" dataType="${formField.dataType}"   :value="formItem.identityNo" />
      <f-form-item label="延误险预约Id"  name="delayriskId" dataType="${formField.dataType}"   :value="formItem.delayriskId" />
      <f-form-item label="出生日期"  name="birthDate" dataType="${formField.dataType}"   :value="formItem.birthDate" />
      <f-form-item label="性别"  name="sex" dataType="number"   :value="formItem.sex" />
      <f-form-item label="延误证明图片"  name="proveImg" dataType="${formField.dataType}"   :value="formItem.proveImg" />
      <f-form-item label="登机牌"  name="boardingPassImg" dataType="${formField.dataType}"   :value="formItem.boardingPassImg" />
      <f-form-item label="银行卡号"  name="bankNo" dataType="${formField.dataType}"   :value="formItem.bankNo" />
      <f-form-item label="开户行"  name="depositBank" dataType="${formField.dataType}"   :value="formItem.depositBank" />
      <f-form-item label="是否申请（1未申请。2申请）"  name="isApply" dataType="number"   :value="formItem.isApply" />
      <f-form-item label="是否申请（1无需受理2待受理3受理通过4受理拒绝）"  name="isCheck" dataType="number"   :value="formItem.isCheck" />
      <f-form-item label=""  name="handleDate" dataType="${formField.dataType}"   :value="formItem.handleDate" />
      <f-form-item label="是否删除"  name="deleted" dataType="number"   :value="formItem.deleted" />
      <f-form-item label="更新人"  name="updateUser" dataType="${formField.dataType}"   :value="formItem.updateUser" />
      <f-form-item label="更新时间"  name="updateTime" dataType="${formField.dataType}"   :value="formItem.updateTime" />
      <f-form-item label="创建人"  name="createUser" dataType="${formField.dataType}"   :value="formItem.createUser" />
      <f-form-item label="创建时间"  name="createTime" dataType="${formField.dataType}"   :value="formItem.createTime" />
    </f-form>
  </div>
</template>
<script>
  import api from './js/api'
  export default {
    name: 'insurantForm',
    props: {},
    data() {
      return {
        refs:this.$refs,
        api:  Object.assign(api, this.api),
        isAdd: true,//是否是添加模式
        loaded: false,//是否加载完成
        formItem: this.getFormItem()
      }
    },
    methods: {
      getFormItem() {
        return {
          insurantId: '',
          userName: '',
          identityType: '',
          identityNo: '',
          delayriskId: '',
          birthDate: '',
          sex: '',
          proveImg: '',
          boardingPassImg: '',
          bankNo: '',
          depositBank: '',
          isApply: '',
          isCheck: '',
          handleDate: '',
          deleted: '',
          updateUser: '',
          updateTime: '',
          createUser: '',
          createTime: ''
        }
      },
      //表单赋值
      setData(data) {
        this.$refs.form.resetFields()
        this.formItem = this.getFormItem()
        if (data && data.insurantId) {
          let params={
              insurantId:data.insurantId
          }
          this.refs['form'].getDetails(params,(data)=>{
             this.formItem=data
             this.loaded = true
          })
          this.isAdd = false
        } else {
          this.loaded = true
        }
      },
      //提交表单
      handleSubmit(callback) {
        this.$refs.form.submit({  }, callback)
      }
    },
    created() {
    },
    components: {}
  }
</script>

<style scoped lang="less" rel="stylesheet/less">

</style>
